part of 'header.dart';

class HeaderMenuView extends StatelessWidget {
  HeaderMenuView({Key? key}) : super(key: key);
  final controller = Get.find<AppMoreController>();
  @override
  Widget build(BuildContext context) {
    var currentIndex = controller.state.currentIndex;

    return Container(
        height: 50.r,
        color: ColorsUtil.bg,
        child: Obx(
          () => TabBar(
              onTap: controller.actionTab,
              controller: controller.state.tabCtrl,
              isScrollable: true,
              indicator: const BoxDecoration(),
              padding: EdgeInsets.symmetric(horizontal: gap12),
              labelPadding: EdgeInsets.only(right: 10.r),
              tabs: controller.state.dataSource
                  .asMap()
                  .map((index, e) {
                    AppModel mod = e.items.first as AppModel;
                    return MapEntry(
                        index,
                        Tab(
                          child: Container(
                            padding: EdgeInsets.symmetric(horizontal: 15.r),
                            alignment: Alignment.center,
                            height: 30.r,
                            decoration: BoxDecoration(
                                color: currentIndex.value == index
                                    ? const Color(0xffcddaf6)
                                    : const Color(0xffe3e6ea),
                                border: currentIndex.value == index
                                    ? Border.all(color: const Color(0xff0d42b0))
                                    : null,
                                borderRadius: BorderRadius.circular(15.r)),
                            child: Text(
                              mod.title,
                              style: pfMediumStyle(
                                  color: currentIndex.value == index
                                      ? const Color(0xff0d42b0)
                                      : ColorsUtil.title,
                                  fontSize: font14),
                            ),
                          ),
                        ));
                  })
                  .values
                  .toList()),
        ));
  }
}
